package net.zjitc.boot2301demo.controller;


import net.zjitc.boot2301demo.pojo.Category;
import net.zjitc.boot2301demo.service.CategoryService;
import net.zjitc.boot2301demo.utils.APIResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/category")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    @RequestMapping ("list")
    @ResponseBody
    public APIResponse<List<Category>> category(){
        List<Category> categoryList = categoryService.findCategoryAll();
        return new APIResponse<List<Category>>(0,"请求成功",categoryList);
    }
}
